﻿using System;
using System.Windows.Forms;
using MailMergeToolForm.Helper;
using MailMergeToolForm.MailMergeService;
namespace MailMergeToolForm.MenuForm.File
{
    public partial class frMultiFileWatermask : Form
    {
        public frMultiFileWatermask()
        {
            InitializeComponent();
        }

        private void btn_ChooseImage_Click(object sender, EventArgs e)
        {
            openImage.Filter = "Image (.jpg)|*.jpg|Bitmap |*.bmp|PNG |*.png";
            openImage.FilterIndex = 1;
            if (openImage.ShowDialog() == DialogResult.OK)
            {
                txtImage.Text = openImage.FileName ?? null;
            }
        }

        private void btn_ChooseInput_Click(object sender, EventArgs e)
        {
            if (folderInput.ShowDialog() == DialogResult.OK)
            {
                txtInput.Text = folderInput.SelectedPath;
            }
        }

        private void btn_ChooseOutPut_Click(object sender, EventArgs e)
        {
            if (folderOutput.ShowDialog() == DialogResult.OK)
            {
                txt_Output.Text = folderOutput.SelectedPath;
            }
        }

        private void btn_Excute_Click(object sender, EventArgs e)
        {
            ServiceClient service = new ServiceClient();
            string[] listofFilePath = FileFolderHelper.GetAllFileWord(txtInput.Text);
            service.ReplaceMailMergeWaterMark(txtImage.Text, listofFilePath, txt_Output.Text+ @"\OutPut",10);
        }
    }
}
